<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html>
<html lang="en">
<head>
<base href="<%=basePath%>">
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/css/bootstrap.min.css">
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/css/main.css">
<link rel="stylesheet"
	href="//apps.bdimg.com/libs/jqueryui/1.10.4/css/jquery-ui.min.css">
<script src="${pageContext.request.contextPath}/js/jquery.min.js"></script>
<script src="${pageContext.request.contextPath}/js/main.js"></script>
<script src="${pageContext.request.contextPath}/js/jqueryui.js"></script>
<script src="//apps.bdimg.com/libs/jqueryui/1.10.4/jquery-ui.min.js"></script>
<title>代理商</title>
</head>

<body>
	<%@ include file="header.jsp"%>
	<%@ include file="left.jsp"%>
	<div id="index"
		style="position: absolute;left: 180px;top: 80px;bottom: 0;right: 0;">


		<style>
.main_div {
	min-width: 1000px;
	min-height: 60px
}

.force-overflow1-1 {
	border: none
}

.buttonPic>span {
	color: #FFFFFF;
	font-size: 36px
}

.pageChange {
	float: right;
	color: #337ab7;
}

.pageChange>span {
	cursor: pointer
}

.pageChange>span:hover {
	color: blue
}
</style>
		<section id="main">
			<div class="scrollbar1-1" id="style1-1">
				<div class="main_div">
					<div class="main_title">
						<span>广告营业额</span>
					</div>
					<form class="form-inline"
						style="margin-top: 30px;margin-left: 20px">
						<div class="form-group">
							<label for="ProductName"> 开始时间:</label> <input type="text"
								class="form-control" name="" id="startTime" placeholder="">
						</div>
						<div class="form-group">
							<label for="userName"> -结束时间:</label> <input type="text"
								class="form-control" name="" id="endTime" placeholder="">
						</div>
						<button type="button" onclick="selectinfo()" class="btn btn-primary">立即查询</button>
					</form>
				</div>
				<div class="force-overflow1-1">
					<table class="table table-condensed table-bordered table-hover"
						id="showTable" style="text-align: center">
						<tr style="background-color: #59c7d2">
							<th style="text-align: center">序号</th>
							<th style="text-align: center">秒杀广告</th>
							<th style="text-align: center">商品名称</th>
							<th style="text-align: center">商品原价</th>
							<th style="text-align: center">秒杀价格</th>
							<th style="text-align: center">商品数量</th>
							<th style="text-align: center">开始日期</th>
							<th style="text-align: center">状态</th>
							<th style="text-align: center">广告费</th>
						</tr>
					</table>
					<div class="pageChange">
						<span onclick="prePage()">&nbsp;&nbsp;上一页&nbsp;&nbsp;</span> <span
							onclick="nextPage()">&nbsp;&nbsp;下一页&nbsp;&nbsp;</span> <em>
							&nbsp; 第&nbsp;<span id="pageNum">1</span>&nbsp;页&nbsp;&nbsp;
						</em> <em>/&nbsp;&nbsp;共&nbsp;<span id="totalpage"></span>&nbsp;页
						</em> <em>&nbsp;&nbsp;&nbsp;跳到第<input id="searchInput"
							style="width:46px" maxlength="4" type="text">页
						</em>
						<button class="btn btn-primary" onclick="searchPage()">搜索</button>
					</div>
					<input style="display:none" value="7" id="pageCount"
						name="pageCount" />
					<div>
						<p>
							营业总金额: <span style="color: red;" id="totalAdMoney"></span>
						</p>
					</div>
				</div>
			</div>
		</section>

	</div>
	<script>
		$(function() {
			selectinfo();
			$("#startTime").datepicker();
			$("#endTime").datepicker();
			$("#startTime").datepicker("option", "dateFormat", "yy-mm-dd");
			$("#endTime").datepicker("option", "dateFormat", "yy-mm-dd");
		})
	
		function selectinfo() {		
			var pageNum = $("#pageNum").html();
			var pageCount = $("#pageCount").val();
			var startTime = $("#startTime").val();
			var endTime = $("#endTime").val();
			if (startTime == "") {
				startTime = null
			} 
			if (endTime == "") {
				endTime = null
			} 
			$.post(urls + "seckillAction/selectSeckillProductByTime",
				{
					startTime : startTime,
					endTime : endTime,
					pageNum : pageNum,
					pageCount : pageCount,
					typeId:1,
					agentId : localStorage.getItem("agentid")
				},
				function(data) {
					
					if (data) {
						var totalpage = data.totalpage;
						var orderlist = data.list;
						$("#totalAdMoney").text(data.totalAdPrice)
						var table = $("#showTable");
						$("tr").remove(".addtr");
						for (var i = 0; i < orderlist.length; i++) {
						var status;
								if (orderlist[i].status == 0) {
									status = "未审核";
								} else if (orderlist[i].status == 1) {
									status = "审核通过";
								} else if (orderlist[i].status == 2) {
									status = "未通过";
								} else if (orderlist[i].status == 3) {
									status = "已发布";
								} else if (orderlist[i].status == 4) {
									status = "已过期";
								}
							var append = "<tr class='addtr'><td>" + (i + 1) + "</td>" +
								"<td ><img style='width:250px;height:100px' src='/seckills/" + orderlist[i].publicityImg + "'/></td>" +
								"<td>" + orderlist[i].productName + "</td>" +
								"<td>" + orderlist[i].productPrice + "</td>" +
								"<td>" + orderlist[i].seckillPrice + "</td>"+
								"<td>" + orderlist[i].inventory + "</td>" +
								"<td>" + orderlist[i].startDate + "</td>" +
								"<td>" + status + "</td>"+
								"<td>" + orderlist[i].adPrice + "</td>"+
								"</tr>";
							table.append(append);
						}
						$("#totalpage").html(totalpage);
					}
				}
				, "json"
			)
		}
	</script>
</body>
</html>
